package thread02;

public class Consumer implements Runnable {

	private String name;
	private Storage storage;
	
	public Consumer(String name, Storage storage) {
		this.name = name;
		this.storage = storage;
	}
	
	@Override
	public void run() {
		while (true) {
			try {
				Product product = storage.pop();
				
				System.out.println(name + "已经消费一个：id为" + product.getId() + "的商品");
				System.out.println("============================");
				
				Thread.sleep(3000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

}
